<script setup lang="ts">
    import type { MessageType } from '@/services/type';
    import { MsgEnum } from '@/enums';
    import Text from '@/components/ChatBox/Content/Render/Text/index.vue';
    import Image from '@/components/ChatBox/Content/Render/Image/index.vue';

    defineProps<{ message: MessageType }>();

    const componentMap = {
        [MsgEnum.UNKNOWN]: '',
        [MsgEnum.TEXT]: Text,
        [MsgEnum.RECALL]: '',
        [MsgEnum.SYSTEM]: '',
        [MsgEnum.IMAGE]: Image,
        [MsgEnum.VOICE]: '',
        [MsgEnum.FILE]: '',
        [MsgEnum.VIDEO]: '',
        [MsgEnum.EMOJI]: '',
    }
</script>
<template>
    <component
        :is="componentMap[message.type]"
        :body="message.body"
        :data-message-id="message.id"
    />
</template>